function Complier (node, vm) {
  this.textRex = /\{\{(.*)\}\}/m
  this.directRex = /^v-(\w+)/
  this.$frag = this.node2Fragment(node, vm)
  return this.$frag
}

Complier.prototype = {
  node3Type(node, vm) {
    if (this.textRex.test(node.nodeValue)) {
      let name = RegExp.$1
      name = name.trim()
      new Watcher(vm, node, name, 'nodeValue')
    }
  },
  node1Type(node, vm) {
    const attrs = node.attributes
    for (let v of attrs) {
      if (this.directRex.test(v.nodeName)) {
        const direction = RegExp.$1
        Directions[direction](vm, node, v.nodeValue)
      }
    }
  },
  node2Fragment(node, vm) {
    const fragment = document.createDocumentFragment()
    let child
    while ((child = node.firstChild)) {
      this.complierElement(child, vm)
      fragment.append(child)
    }
    return fragment
  },
  complierElement(node, vm) {
    const nodeType = node.nodeType
    this['node' + nodeType + 'Type'](node, vm)
  }
}